<?php
/**
 * 阿里短信
 * User: Administrator
 * Date: 2018/11/2 0002
 * Time: 22:34
 */

namespace library;
use think\Config;
class Alisms{


    public  static function getObject()
    {
        vendor('aliyun-dysms.api_demo.SmsDemo');
        $alismsConfig=config('alimsg');
        $acsObject=new \SmsDemo($alismsConfig);
        return $acsObject;

    }

    /**
     * 转换数据结果输出
     *
     * @param  int $phone 手机号
     * @param  string  $type 模板
     * @param  array $array
     * @return array
     */
    public static function  send($phone,$type,$array){
        $acsObject =self::getObject();
        $resut= $acsObject::sendSms($phone,$type,$array);
        $resut=(array)$resut;
       if($resut['Code'] != 'OK'){
             return false;
        }
        return true;
    }
}
